'use strict';

angular.module('myApp.global', []).controller('globalCtrl',["$scope","$http",function($scope,$http){

	//显示列表
	$http.get('v1/setting').success(function(data){
		
		if(!data.error){
			$scope.globals = data.result;
		}
		
	});

	$scope.submit = function(global){
		console.log(global);
		$http.put('v1/setting/'+ global.id,global).success(function(data){
			if(!data.error){
				global.edit = false;
				alert(data.message,"success");
			}else{
				alert(data.message);
			}

		});
	};

}]);